package com.terrace.web.tagext.easyui;

import javax.servlet.jsp.JspException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.terrace.web.tagext.easyui.model.GridOpt;
import com.terrace.web.tagext.easyui.support.DataGridTagSupport;
import com.terrace.web.tagext.easyui.support.GridOptTagSupport;

/**
 * 表格URL自定义标签操作
 * @author jiangyg
 *
 */
public class GridUrlOptTag extends GridOptTagSupport {

	private static final long serialVersionUID = -2166093868035892L;
	
	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(GridUrlOptTag.class);

	@Override
	public int doStartTag() throws JspException {
		return EVAL_PAGE;
	}

	@Override
	public int doEndTag() throws JspException {
		try {
			DataGridTagSupport datagrid = (DataGridTagSupport) findAncestorWithClass(this, DataGridTagSupport.class);
			datagrid.addGridOpt(new GridOpt(this));
		} catch (Exception e) {
			logger.error("生成表格URL操作失败：", e);
		}
		return EVAL_PAGE;
	}

}
